package a.f.j;

import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.m;
import a.c.n;
import a.c.q;
import a.c.w;
import a.i.l;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;

public class v
{
  private b_ a;
  private c_ b;
  private a_ c;
  private q d;
  private ArrayList[] e;
  private double[] f;
  private ArrayList[] g;
  private double[] h;
  private e[] i;
  private ArrayList[] j;
  private ArrayList[] k;
  private ArrayList m;
  private ArrayList n;
  private a.c.ab o;
  private n p;
  public static int q;
  
  public v(q paramq, n paramn)
  {
    this.d = paramq;
    this.p = paramn;
    int i1 = paramq.j();
    int i2 = paramq.l() + 1;
    this.e = new ArrayList[i2];
    this.f = new double[i2];
    this.g = new ArrayList[i2];
    this.h = new double[i2];
    int i3 = 0;
    do
    {
      if (i3 >= i2) {
        break;
      }
      this.e[i3] = new ArrayList(i1);
      this.g[i3] = new ArrayList(i1);
      i3++;
      if (bool) {
        break label151;
      }
      if (i4 != 0) {
        break label150;
      }
    } while (i4 == 0);
    this.k = new ArrayList[i1];
    if (!bool)
    {
      this.j = new ArrayList[i1];
      label150:
      label151:
      i3 = 0;
      if (i3 < paramq.j()) {
        this.k[i3] = new ArrayList(i1);
      }
    }
    do
    {
      this.j[i3] = new ArrayList(i1);
      i3++;
      if ((!bool) && (i4 != 0)) {
        return;
      }
      if (i4 == 0) {
        break;
      }
      this.o = new a.c.ab();
      this.i = new e[paramq.k() + 1];
      this.a = new b_();
      this.b = new c_();
    } while (bool);
    this.c = new a_();
  }
  
  public ArrayList a()
  {
    return this.m;
  }
  
  public ArrayList b()
  {
    return this.n;
  }
  
  public a.c.ab c()
  {
    return this.o;
  }
  
  public void a(bb parambb, int[] paramArrayOfInt)
  {
    boolean bool = ab.g;
    int i6 = ab.f;
    int i1 = parambb.size();
    a.c.ab localab = new a.c.ab();
    int i2 = 0;
    Object localObject1 = parambb.l();
    if (((w)localObject1).e()) {}
    while (bool)
    {
      this.i[(++i2)] = ((w)localObject1).d();
      ((w)localObject1).f();
      if ((!bool) && (i6 != 0)) {
        break label94;
      }
      if (i6 == 0) {
        break;
      }
    }
    this.o.clear();
    label94:
    localObject1 = parambb.m();
    e locale1 = parambb.n();
    int i3 = 0;
    d locald = ((e)localObject1).b(locale1);
    if (!bool) {
      if (locald == null) {
        locald = locale1.b((e)localObject1);
      }
    }
    if (!bool)
    {
      if (locald == null) {
        i3 = 1;
      }
    }
    else {
      locald = this.d.a((e)localObject1, locale1);
    }
    int i4 = 0;
    if (i4 < this.d.l()) {
      this.e[i4].clear();
    }
    while (bool)
    {
      this.f[i4] = 0.0D;
      i4++;
      if (bool) {
        break label227;
      }
      if (i6 != 0) {
        break label224;
      }
      if (i6 == 0) {
        break;
      }
    }
    a(paramArrayOfInt);
    label224:
    label227:
    i4 = i1 - 1;
    do
    {
      if (i4 <= 0) {
        break;
      }
      e locale2 = this.i[i4];
      if (i6 != 0) {
        break label333;
      }
      if (!this.k[locale2.f()].isEmpty()) {
        a(locale2, this.i, this.e, this.f, paramArrayOfInt);
      }
      i4--;
    } while (i6 == 0);
    this.m = new ArrayList(this.e[locald.d()]);
    i4 = this.m.indexOf(locald);
    if ((!bool) && (i4 >= 0)) {
      label333:
      this.m.remove(i4);
    }
    int i5 = 0;
    Object localObject2;
    do
    {
      do
      {
        if (i5 >= this.m.size()) {
          break;
        }
        localObject2 = (d)this.m.get(i5);
        localab.add(localObject2);
        this.d.f((d)localObject2);
        i5++;
        if (bool) {
          break label420;
        }
        if (i6 != 0) {
          break label418;
        }
      } while (i6 == 0);
    } while (bool);
    i5 = 0;
    label418:
    label420:
    if (i5 < this.d.l()) {
      this.e[i5].clear();
    }
    while (bool)
    {
      this.f[i5] = 0.0D;
      i5++;
      if (bool) {
        break label479;
      }
      if (i6 != 0) {
        break label476;
      }
      if (i6 == 0) {
        break;
      }
    }
    a(paramArrayOfInt);
    label476:
    label479:
    i5 = i1 - 1;
    do
    {
      if (i5 <= 0) {
        break;
      }
      localObject2 = this.i[i5];
      if (i6 != 0) {
        break label574;
      }
      if (!this.k[localObject2.f()].isEmpty()) {
        a((e)localObject2, this.i, this.e, this.f, paramArrayOfInt);
      }
      i5--;
    } while (i6 == 0);
    this.n = new ArrayList(this.e[locald.d()]);
    if ((!bool) && (i3 != 0))
    {
      label574:
      i4 = this.n.indexOf(locald);
      if (bool) {
        break label609;
      }
      if (i4 >= 0) {
        this.n.remove(i4);
      }
    }
    label609:
    i5 = 0;
    do
    {
      do
      {
        if (i5 >= this.n.size()) {
          break;
        }
        localObject2 = (d)this.n.get(i5);
        localab.add(localObject2);
        if (bool) {
          break label695;
        }
        this.d.f((d)localObject2);
        i5++;
        if (i6 != 0) {
          break label691;
        }
      } while (i6 == 0);
    } while (bool);
    if (i3 != 0) {
      this.d.a(locald);
    }
    label691:
    label695:
    m localm = this.d.w();
    do
    {
      do
      {
        if (!localm.e()) {
          break;
        }
        localObject2 = localm.a();
        this.o.add(localObject2);
        this.d.f((d)localObject2);
        localm.f();
        if (bool) {
          break label779;
        }
        if (i6 != 0) {
          break label772;
        }
      } while (i6 == 0);
    } while (bool);
    localm = localab.l();
    label772:
    label779:
    do
    {
      while (i6 == 0)
      {
        if (!localm.e()) {
          break;
        }
        this.d.g(localm.a());
        localm.f();
      }
    } while (bool);
  }
  
  private void a(e parame, e[] paramArrayOfe, ArrayList[] paramArrayOfArrayList, double[] paramArrayOfDouble, int[] paramArrayOfInt)
  {
    boolean bool = ab.g;
    int i6 = ab.f;
    int i1 = parame.f();
    ArrayList localArrayList1 = this.k[i1];
    d locald1 = (d)localArrayList1.get(localArrayList1.size() - 1);
    m localm1 = paramArrayOfInt[locald1.a(parame).f()];
    m localm2 = paramArrayOfInt[i1];
    Object localObject1 = new ArrayList();
    double d1 = 0.0D;
    bb localbb = new bb();
    Object localObject2 = this.d.w();
    Object localObject3;
    do
    {
      if (!((m)localObject2).e()) {
        break;
      }
      localObject3 = ((m)localObject2).a();
      if (i6 != 0) {
        break label156;
      }
      int i2 = ((d)localObject3).d();
      this.g[i2].clear();
      this.h[i2] = 0.0D;
      ((m)localObject2).f();
    } while (i6 == 0);
    label156:
    localObject2 = localm2;
    Object localObject4;
    Object localObject5;
    label280:
    do
    {
      if (localObject2 > localm1) {
        break;
      }
      localObject3 = paramArrayOfe[localObject2];
      if (i6 != 0) {
        break label316;
      }
      localObject4 = ((e)localObject3).l();
      do
      {
        do
        {
          if (!((m)localObject4).e()) {
            break label280;
          }
          d locald2 = ((m)localObject4).a();
          e locale = locald2.a((e)localObject3);
          localObject5 = paramArrayOfInt[locale.f()];
          if (i6 != 0) {
            break;
          }
          if (localObject5 <= localm1)
          {
            if (bool) {
              continue;
            }
            if ((localObject5 >= localm2) && ((bool) || (localbb.d(locale) == null))) {
              localbb.add(locale);
            }
          }
          ((m)localObject4).f();
        } while (i6 == 0);
        localObject2++;
      } while (bool);
    } while (i6 == 0);
    this.c.a(paramArrayOfInt);
    if (!bool) {
      localbb.a(this.c);
    }
    label316:
    localObject2 = localbb.l();
    label495:
    do
    {
      double d2;
      int i3;
      do
      {
        if (!((w)localObject2).e()) {
          return;
        }
        localObject3 = ((w)localObject2).d();
        localObject4 = null;
        d2 = 0.0D;
        localObject5 = this.j[localObject3.f()];
        i3 = 0;
        do
        {
          if (i3 >= ((ArrayList)localObject5).size()) {
            break;
          }
          localObject6 = (d)((ArrayList)localObject5).get(i3);
          if (i6 != 0) {
            break label495;
          }
          if (paramArrayOfInt[localObject6.a(localObject3).f()] <= localm2) {
            break;
          }
          i4 = ((d)localObject6).d();
          if (!bool)
          {
            if (d2 < this.h[i4])
            {
              localObject4 = this.g[i4];
              d2 = this.h[i4];
            }
            i3++;
          }
        } while (i6 == 0);
      } while (bool);
      if (!bool) {
        if (d2 > d1)
        {
          localObject1 = localObject4;
          d1 = d2;
        }
      }
      Object localObject7;
      if (i3 < ((ArrayList)localObject5).size())
      {
        if (bool) {
          break label601;
        }
        localObject6 = (d)((ArrayList)localObject5).get(i3);
        if (paramArrayOfInt[localObject6.a(localObject3).f()] == localm2)
        {
          i4 = ((d)localObject6).d();
          ((ArrayList)localObject1).add(localObject6);
          localObject7 = paramArrayOfArrayList[i4];
          ((ArrayList)localObject7).clear();
          ((ArrayList)localObject7).addAll((Collection)localObject1);
          d1 += this.p.getInt(localObject6);
          paramArrayOfDouble[i4] = d1;
        }
      }
      Object localObject6 = this.k[localObject3.f()];
      int i4 = 0;
      do
      {
        do
        {
          if (i4 >= ((ArrayList)localObject6).size()) {
            break label724;
          }
          localObject7 = (d)((ArrayList)localObject6).get(i4);
          if (i6 != 0) {
            break;
          }
          if (paramArrayOfInt[localObject7.a(localObject3).f()] > localm1) {
            break label724;
          }
          if (localObject3 != localbb.m())
          {
            int i5 = ((d)localObject7).d();
            ArrayList localArrayList2 = new ArrayList((Collection)localObject1);
            localArrayList2.addAll(paramArrayOfArrayList[i5]);
            this.g[i5] = localArrayList2;
            this.h[i5] = (d1 + paramArrayOfDouble[i5]);
          }
          i4++;
        } while (i6 == 0);
        ((w)localObject2).f();
      } while (bool);
    } while (i6 == 0);
    label601:
  }
  
  private void a(int[] paramArrayOfInt)
  {
    boolean bool = ab.g;
    int i4 = ab.f;
    this.a.a(paramArrayOfInt);
    this.b.a(paramArrayOfInt);
    w localw = this.d.v();
    label180:
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      int i1 = locale.f();
      ArrayList localArrayList1 = this.j[i1];
      localArrayList1.clear();
      ArrayList localArrayList2 = this.k[i1];
      localArrayList2.clear();
      m localm = locale.l();
      do
      {
        do
        {
          if (!localm.e()) {
            break label180;
          }
          d locald = localm.a();
          int i2 = paramArrayOfInt[locale.f()];
          int i3 = paramArrayOfInt[locald.a(locale).f()];
          if (i4 != 0) {
            break;
          }
          if (i2 < i3)
          {
            localArrayList2.add(locald);
            if (bool) {
              continue;
            }
            if (i4 == 0) {}
          }
          else
          {
            localArrayList1.add(locald);
          }
          localm.f();
        } while (i4 == 0);
        this.a.a(locale);
        l.a(localArrayList1, this.a);
        this.b.a(locale);
        l.a(localArrayList2, this.b);
        localw.f();
      } while (bool);
    } while (i4 == 0);
  }
  
  public void d() {}
  
  static class a_
    implements Comparator
  {
    private int[] a;
    
    public void a(int[] paramArrayOfInt)
    {
      this.a = paramArrayOfInt;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      int i = this.a[((e)paramObject1).f()];
      int j = this.a[((e)paramObject2).f()];
      return l.a(i, j);
    }
  }
  
  static class c_
    implements Comparator
  {
    private e a;
    private int[] c;
    
    public void a(e parame)
    {
      this.a = parame;
    }
    
    public void a(int[] paramArrayOfInt)
    {
      this.c = paramArrayOfInt;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool = ab.g;
      d locald1 = (d)paramObject1;
      d locald2 = (d)paramObject2;
      int i = this.c[locald1.a(this.a).f()];
      int j = this.c[locald2.a(this.a).f()];
      if (!bool)
      {
        if (i < j) {
          return -1;
        }
        if (bool) {}
      }
      else if (i > j)
      {
        return 1;
      }
      return 0;
    }
  }
  
  static class b_
    implements Comparator
  {
    private e a;
    private int[] c;
    
    public void a(e parame)
    {
      this.a = parame;
    }
    
    public void a(int[] paramArrayOfInt)
    {
      this.c = paramArrayOfInt;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      boolean bool = ab.g;
      d locald1 = (d)paramObject1;
      d locald2 = (d)paramObject2;
      int i = this.c[locald1.a(this.a).f()];
      int j = this.c[locald2.a(this.a).f()];
      if (!bool)
      {
        if (i < j) {
          return 1;
        }
        if (bool) {}
      }
      else if (i > j)
      {
        return -1;
      }
      return 0;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.j.v

 * JD-Core Version:    0.7.0.1

 */